<%@ page language="java" pageEncoding="utf8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>" type="text/css" />
	</head>
	<body  >
		<div id="headBar" class="head_content"></div>
		<div id="main" class="main_content">
			<form class="tableform" id="model_form" action="sys_pay_save.html" method="post">
				<input value="${orderPaymentCfg.pcId }" name="orderPaymentCfg.pcId" type="hidden" />
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<tr>
								<th>
									支付方式：
								</th>
								<td>
									<select id="orderPaymentCfg_payType" onchange="getPayment('orderPaymentCfg_payType');" name="orderPaymentCfg.payType">
										<option value="alipay">
											支付宝
										</option>
										<option value="offline">
											线下支付
										</option>

									</select>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="division">
					<div id="paylist-item">
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tbody>
								<tr>
									<th>
										支付方式名称：
									</th>
									<td>
										<input value="${orderPaymentCfg.customName }" style="width: 280px;" name="orderPaymentCfg.customName" class="x-input " />
									</td>
								</tr>
								<tr>
									<th>
										支持交易货币：
									</th>
									<td>
										人民币
									</td>
								</tr>
								<tr>
									<th>
										合作者身份(parterID)：
									</th>
									<td>
										<input value="${orderPaymentCfg.payMemberId}" style="width: 280px;" name="orderPaymentCfg.payMemberId" class="x-input " />
									</td>
								</tr>
								<tr>
									<th>
										交易安全校验码(key)：
									</th>
									<td>
										<input value="${orderPaymentCfg.payPrivateKey}" style="width: 280px;"  name="orderPaymentCfg.payPrivateKey" class="x-input " />
									</td>
								</tr>
								<tr id="orderPaymentCfg_alipayType_tr">
									<th>
										选择接口类型：
									</th>
									<td>
										<select name="orderPaymentCfg.alipayType" id="orderPaymentCfg_alipayType" type="select" class="x-input-select  inputstyle">
											<option value="trade_create_by_buyer"  >
												使用标准双接口
											</option>
											<option value="create_partner_trade_by_buyer">
												使用担保交易接口
											</option>
											<option value="create_direct_pay_by_user">
												使用即时到帐交易接口
											</option>
										</select>
									</td>
								</tr>
								<tr id="orderPaymentCfg_sellerEmail">
									<th>
										收款账号(seller_email)：
									</th>
									<td>
										<input value="${orderPaymentCfg.sellerEmail}" style="width: 280px;"  name="orderPaymentCfg.sellerEmail" class="x-input " />
									</td>
								</tr>
								<tr id="setfee">
									<th>
										支付手续费设置：
									</th>
									<td>
										<input type="radio" <c:if test="${orderPaymentCfg.payMethod == 'ratio'}">checked="checked"</c:if> value="ratio" name="orderPaymentCfg.payMethod" />
										按比例收费&nbsp;&nbsp;&nbsp;
										<input type="radio" value="fix" <c:if test="${orderPaymentCfg.payMethod == 'fix'}">checked="checked"</c:if> name="orderPaymentCfg.payMethod" />
										固定费用&nbsp;&nbsp;&nbsp;
									</td>
								</tr>
								<tr id="rate">
									<th></th>
									<td>
										费率/金额：
										<input size="8" value="<fmt:formatNumber pattern="0.00" value="${orderPaymentCfg.fee}" />" name="orderPaymentCfg.fee" class="x-input " />
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;说明：
										<span id="fee_desc">*费率% / -金额</span>
									</td>
								</tr>
								<tr>
									<th>
										是否支持货到付款：
									</th>
									<td>
										<input type="radio" value="true" <c:if test="${orderPaymentCfg.codFlag}">checked="checked"</c:if> name="orderPaymentCfg.codFlag" class="x-input " />
										是
										<input type="radio" value="false" <c:if test="${!orderPaymentCfg.codFlag}">checked="checked"</c:if> name="orderPaymentCfg.codFlag" class="x-input " />
										否


									</td>
								</tr>
								<tr>
									<th>
										排序：
									</th>
									<td>
										<input value="${orderPaymentCfg.showOrder}" name="orderPaymentCfg.showOrder" style="width: 50px;" class="x-input " />
									</td>
								</tr>
								<tr>
									<th>
										介绍：
									</th>
									<td>
										<textarea class="jquery_ckeditor" cols="80" id="editor1" name="orderPaymentCfg.description" rows="10">${orderPaymentCfg.description}</textarea>
									</td>
								</tr>
							</tbody>
						</table>
					</div>

				</div>
				<div class="table-action">
					<button class="btn" type="submit">
						<span><span>保存</span> </span>
					</button>
				</div>
			</form>
		</div>
		<div id="footBar" class="foot_content"></div>



		<script type="text/javascript" src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/jquery.validate.js'/>"></script>
		<script type="text/javascript" src="<c:url value="/ckeditor/ckeditor.js"/>"></script>
		<script type="text/javascript" src="<c:url value="/ckeditor/adapters/jquery.js"/>"></script>
		<script type="text/javascript">
	$(document).ready(function() {
		var validator = $("#model_form").validate( {
			errorElement : "div",
			errorClass : "x-vali-error",
			onfocusout : false,
			rules : {
				'orderPaymentCfg.customName' : "required",
				'orderPaymentCfg.payMemberId' : "required",
				'orderPaymentCfg.payPrivateKey' : "required",
				'orderPaymentCfg.payMethod' : "required",
				'orderPaymentCfg.fee' : {
					required: true,
					number:true
				},
				'orderPaymentCfg.showOrder' : {
					required: true,
					number:true
				}
			},
			messages : {
				 
				
				'orderPaymentCfg.customName' : "必填字段",
				'orderPaymentCfg.payMemberId' : "必填字段",
				'orderPaymentCfg.payPrivateKey' : "必填字段",
				'orderPaymentCfg.payMethod' : "必填字段",
				'orderPaymentCfg.fee' : {
					required: "必填字段",
					number:"请输入数字"
				},
				'orderPaymentCfg.showOrder' : {
					required: "必填字段",
					number:"请输入数字"
				}
			},
			errorPlacement : function(error, element) {
				element.removeClass('x-vali-error');
				error.appendTo(element.parent());

			},

			success : function(div) {
				$(div).remove();
			}
		});
	});
	
	
	var config = {
		toolbar:
		[
			[ 'Bold', 'Italic', 'Underline', 'StrikeThrough', '-',
							'Subscript', 'Superscript' ],
					[ 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent',
							'Blockquote' ],
					[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
							'JustifyFull' ],
					[ 'Link', 'Unlink', 'Anchor' ],
					[ 'Style', 'FontFormat', 'FontName', 'FontSize' ],
					[ 'Image', 'Flash', 'Table', 'Rule', 'Smiley',
							'SpecialChar' ], [ 'TextColor', 'BGColor','Source' ]
		],
		filebrowserImageUploadUrl : '<c:url value="/uploadFile.html?Type=Image"/>',
		filebrowserFlashUploadUrl : '/ckeditor/ckeditor/uploader?Type=Flash'
	};
	$('.jquery_ckeditor').ckeditor(config);   
	
	function getPayment(id){
		var value = $('#'+id).val();
		if(value=='alipay'){
			$('#orderPaymentCfg_alipayType_tr').css('display','');
			$('#orderPaymentCfg_sellerEmail').css('display','');
		}else{
			$('#orderPaymentCfg_alipayType_tr').css('display','none');
			$('#orderPaymentCfg_sellerEmail').css('display','none');
		}		
	}
	$('#orderPaymentCfg_payType').attr('value','${orderPaymentCfg.payType}');
	$('#orderPaymentCfg_alipayType').attr('value','${orderPaymentCfg.alipayType}');
	
	getPayment('orderPaymentCfg_payType');
	
</script>
	</body>
</html>